// 格式化日期
function formatDate(date, format) {
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  
  format = format.replace('yyyy', year);
  format = format.replace('MM', month < 10 ? '0' + month : month);
  format = format.replace('dd', day < 10 ? '0' + day : day);
  
  return format;
}

// 获取星期几
function getWeekDay(date) {
  const weekDays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
  return weekDays[date.getDay()];
}

module.exports = {
  formatDate: formatDate,
  getWeekDay: getWeekDay
};